import request from '@/utils/request'

const startUrl = '/notice'

/**
 * 获取初始未读信息
 * @param userStore
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const unreadInitial = (userStore) =>
    request.get(startUrl + '/unread/initial', {
        headers: {
            'User-Token': userStore.$state.jwtEntity.jwt,
            'User-Secret-Key': userStore.$state.jwtEntity.signKeyStr
        }
    })

/**
 * 更新已读消息
 * @param userStore
 * @param offsetStr
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const readOffset = (userStore, offsetStr) =>
    request.get(startUrl + '/read', {
        params: {
            'offset_str': offsetStr
        }
        ,
        headers: {
            'User-Token': userStore.$state.jwtEntity.jwt,
            'User-Secret-Key': userStore.$state.jwtEntity.signKeyStr
        }
    })